import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [vue()],
  server: {
    cors: true,
    proxy: {
      "/app-dev": {
        target: "http://gmall-h5-api.atguigu.cn",
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/app-dev/, ""),
      },
      "/api": {
        target: "http://sph-h5-api.atguigu.cn", // 目标服务器地址
        changeOrigin: true,
        // 路径是否需要重写：看接口文档是否需要请求前缀
        // pathRewrite: {
        //   "^/api": "",
        // },
      },
    },
  },
});
